The present invention relates to electronic data processing, and more specifically concerns the loading of software modules for programs written for different processing platforms.
Frequently, a computer application program written for one digital processor, operating system, or other platform must be executed on another platform. This requires translation of the program""s instruction codes, data formats, application-program interfaces (APIs), and possibly other characteristics as well. A conventional program variously known as an emulator, simulator, translator, or interpreter translates the necessary application-program characteristics after the operating system loads the application.
Furthermore, few present programs are standalone entities. An application program almost always performs low-level functions by calling program code located in separate modules, sometimes known as dynamic link libraries (DLLs). These modules in turn may call other modules for performing lower-level functions. Because many application programs may require the same low-level functions, DLLs and similar modules are often shared among a group of applications. Applications and modules specify the modules they require in internally accessible load lists.
The growing use of emulators and other multiplatform environments results in related groups of modules, such as a first group for the platform being emulated, and a second group for the native platform upon which the emulation occurs. When an operating-system loader loads an application written for the first (emulated) platform, it must sometimes load modules for the second (native) platform rather than the first-platform modules specified in the application""s load list.
Some multiple-platform systems have employed multiple loaders, one for the emulated platform and another for the native platform. Each loader recognizes only the module names in its own group, to avoid conflicts. However, this approach is error-prone. First, the semantics of the two loaders may differ. Secondly, DLL modules have a reference count indicating when they can be unloaded from memory; keeping these counts synchronized between two or more loaders ranges from very difficult to impossible.
In addition, multiplatform programs may employ a second type of DLL module, sometimes called a xe2x80x9cthank module.xe2x80x9d Thank modules come in pairs (or triples, etc.); one module of the pair implements a set of APIs for the first platform, while the second implements corresponding APIs for the second platform. An application-program version written for one platform loads the first module of the pair, while the version for the other platform must load the second module of the same pair. In the past, special handling has been required to load the proper one of the think modules for the application version being processed.
A software-module loader loads modules specified by an application program which are written for different platforms. The loader uses a name list having entries each containing the name of a module for one platform and the name of a corresponding module for another platform. As the loader sequences through a load list of modules, it checks the name of each module against the name list. If the name list specifies a corresponding second-platform module, then the loader loads that module instead of the one in the load list. In this way, the same loader handles modules from both platforms, and avoids requiring coordination with a separate loader for each platform. The loader keeps a reference count of loaded modules. If the same module is again encountered in the load list, its count is merely increased, instead of loading it again. Because only one reference count is used for modules of all platforms, the loader avoids system crashes which may occur when multiple counts might unload a module before all programs which use it have completed execution.
The loader may also handle a special type of translation or xe2x80x9cthinkxe2x80x9d module by recognizing the special type and bypassing a test which would otherwise prevent it from loading. This permits modules of different types to be loaded by the same loader, again simplifying reference counting.
Other features and advantages, as well as modifications within the spirit of the invention, will appear to those skilled in the art from the following detailed description.